<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style type="text/css">
        * {
            padding: 0;
            margin: 0;
            border: 0;
            list-style: none;
        }

        body {
            background: #000;
        }

        .box {
            width: 600px;
            height: 350px;
            border: 1px solid #f40;
            margin: 50px auto;
            overflow: hidden;
        }

        .box ul {
            width: 9999px;
            position: relative;
        }

        .box ul li {
            float: left;
        }

        .box ul li img {
            width: 600px;
            height: 350px;
        }
    </style>
    <script src="js/jquery.min.3.4.1.js"></script>
</head>

<body>
    <div class="box">

        <ul>
            <li><img src="images/0.jpg" alt=""></li>
            <li><img src="images/1.jpg" alt=""></li>
            <li><img src="images/2.jpg" alt=""></li>
            <li><img src="images/3.jpg" alt=""></li>
            <!--不要出现黑边-->
            <li><img src="images/4.jpg" alt=""></li>
            <li><img src="images/0.jpg" alt=""></li>
        </ul>

    </div>

    <script>
        var leftX = 0;
        var timer = null;

        function scrollPic() {
            timer = setInterval(function () {
                if (($('ul').children().length - 1) * -600 === leftX) {
                    $('ul').css({ left: 0 });
                    leftX = 0;
                }
                leftX -= 4;
                $('ul').css({ left: leftX });
            }, 15);
        }
        scrollPic();

        $('li').hover(function () {
            clearInterval(timer);
            $(this).stop().fadeTo(300, 1).siblings().stop().fadeTo(300, 0.3);
        }, function () {
            $('li').stop().fadeTo(300, 1);
            scrollPic();
        })
    </script>
</body>

</html>